import { DTaroAjax } from '@/http/http'

const base = '/api/sys-authorize'

const cookUser = {
    addUserForm(params) {
        return DTaroAjax(`${base}/user/infoMy`, params, 'POST')
    },
    userDetail(params) {
        return DTaroAjax(`${base}/user/infoMy/getEmpApproInfo`)
    },
    addEnterpriseForm(params) {
        return DTaroAjax(`${base}/info/enterprise`, params, 'POST')
    },
    myEmployeeList(params) {
        return DTaroAjax(`${base}/user/infoMy/getEmployeeList`, params)
    },
    myselfDetail(params) {
        return DTaroAjax(`${base}/user/infoMy/getInfo`, params)
    },
    reviewEmployee(params) {
        return DTaroAjax(`${base}/user/infoMy/review`, params)
    },
    ApproEntryprise(params) {
        return DTaroAjax(`${base}/info/enterpriseAppro/enterpriseAppro`, params, 'POST')
    },
    //员工认证
    ApproEmployee(params) {
        return DTaroAjax(`${base}/info/enterpriseAppro/employeeAppro`, params, 'POST')
    },
    //获取企业信息
    getEntinfo(params) {
        return DTaroAjax(`${base}/info/enterprise/getEntInfo`, params)
    },

    // 获取企业列表信息
    getEnterpriseList(params) {
        return DTaroAjax(`${base}/info/enterprise/getEntList`, params)
    },

    // 信息认证
    getConfirmInfo() {
        return DTaroAjax(`${base}/info/enterprise/getApproInfo`)
    },

    // 修改手机号码
    setUserPhone(params) {
        return DTaroAjax(`${base}/user/changePhone`, params)
    },
    //验证码校验

    checkCode(params) {
        return DTaroAjax(`${base}/userApp/check?code=${params.code}&mobile=${params.mobile}`, {}, 'post', true, false)
    },

    // 修改密码
    setUserPass(params) {
        return DTaroAjax(`${base}/user/changePassword`, params)
    },
    forgetPwd(params) {
        return DTaroAjax(`${base}/userApp/forgetPwd?mobile=${params.mobile}&pwd=${params.pwd}&code=${params.code}`, {}, 'post', true, false)
    },
    // 上传企业图片
    uploadCompany(params) {
        return DTaroAjax(`${base}/info/enterprise/photo`, params)
    },

    //员工认证撤回
    recallEmployeeAppro() {
        return DTaroAjax(`${base}/user/infoMy/employeeApproWithdraw`)
    },

    // 修改名字
    setUserName(params) {
        return DTaroAjax(`${base}/user/changeName`, params)
    },
    //退出登录
    logout() {
        return DTaroAjax(`${base}/dsf/logout`, {}, 'POST')
    },
    // 注销账号
    onLogoutB() {
        return DTaroAjax(`${base}/user/infoMy/logout/B`, {}, 'GET')
    },
    // 修改名字
    setUserName(params) {
        return DTaroAjax(`${base}/user/changeName`, params)
    },
    // 旧密码校验
    getPasswordRight(params) {
        return DTaroAjax(`${base}/user/oldPasswordCheck`, params)
    },
    // 获取验证码
    getUserCode(params) {
        return DTaroAjax(`${base}/userApp/acquire?mobile=${params.mobile}&type=${params.type}`, params, 'POST', false, false)
    },
    //移除员工
    delMyEmp(params) {
        return DTaroAjax(`${base}/userApp/deleteEmp?empId=${params.empId}`, params, 'POST')
    },
    /**
     * 申请个人认证
     * **/
    personalAuth(params) {
        return DTaroAjax(`${base}/user/infoMy/personalAuth`, params, 'POST')
    },
    /**
     * 查询企业名称是否存在
     * **/
    searchByEntName(params) {
        return DTaroAjax(`${base}/info/enterprise/searchByEntName?entName=${params.entName}`, {}, 'POST')
    },
    /**
     * 企业管理员获取是否有待审批员工
     * **/
    searchEmployeeAppr(params) {
        let { entId } = params
        return DTaroAjax(`${base}/info/enterprise/searchEmployeeAppr?entId=${entId}`, {}, 'POST')
    },
    /**
     * 申请加入企业列表
     * **/
    searchEmployeeApprList(params) {
        return DTaroAjax(`${base}/info/enterprise/searchEmployeeApprList?entId=${params.entId}`, {}, 'POST')
    },
    /**
     * 获取企业员工列表
     * **/
    searchEmployeeList(params) {
        let { entId, imName = '' } = params
        return DTaroAjax(`${base}/info/enterprise/searchEmployeeList?entId=${entId}&imName=${imName}`, {}, 'POST')
    },
    /**
     * 申请修改营业执照
     * **/
    updateEntBusinessLicense(params) {
        return DTaroAjax(`${base}/info/enterprise/updateEntBusinessLicense`, params, 'POST')
    },
    /**
     * 移除企业成员
     * **/
    removeEmployee(params) {
        let { myId, entName } = params
        return DTaroAjax(`${base}/info/enterprise/removeEmployee?myId=${myId}&entName=${entName}`, {}, 'POST')
    },
    /**
     * 链接申请加入企业
     * **/
    approveEntByUrl(params) {
        const { entId, name, mobile, post, code } = params
        return DTaroAjax(`${base}/info/enterprise/approveEntByUrl?entId=${entId}&name=${name}&mobile=${mobile}&post=${post}&code=${code}`, {}, "POST")
    },
    /**
     * 获取个人认证详情
     */
    getPersonalAuthInfo(params) {
        return DTaroAjax(`${base}/user/infoMy/getPersonalAuthInfo`, params, 'get')
    },
    // 获取员工审核详细
    getEmpApproInfo() {
        return DTaroAjax(`${base}/user/infoMy/getEmpApproInfo`, {}, 'get')
    },
	// 我的界面
	myInfo() {
	  return DTaroAjax(`${base}/user/infoMy/myInfo`, {}, 'get')
	},
	// 获取企业审核列表
	getEntAuthList(params) {
	    return DTaroAjax(`${base}/info/enterprise/getEntList`, params, 'get')
	},
	// 获取企业审核详情
	getEntAuthDetail(params) {
	    return DTaroAjax(`${base}/info/enterprise/getEntInfo2`, params, 'get')
	},
	getPersonAuthList(params) {
	    return DTaroAjax(`${base}/user/infoMy/getAuthList`, params, 'get')
	},
	enterpriseReview(params) {
	    return DTaroAjax(`${base}/info/enterprise/review`, params, 'get')
	},
    personReview(params) {
        return DTaroAjax(`${base}/user/infoMy/personalAuthAppro`, params, 'post', true, true, true)
    }
}

export default cookUser
